package com.Design.Chain.now;

import com.Design.Chain.Request;

/**
 * @Author Lc
 * @Date 2023/9/29
 * @PackageName: com.Design.Chain.now
 * @ClassName: Executive
 * @Description:
 */

public class Executive extends Manager{


    public Executive(String name, String role) {
        super(name, role);
    }

    @Override
    public void getResult(Request request) {
        if(request.getNumber() <= 5){
            System.out.println(this.getName() + ":" + request.getMessage() + "数量" + request.getNumber() + "天，被批准");
        }else {
            System.out.println(this.getName() + ":" + request.getMessage() + "数量" + request.getNumber() + "天，无法被批准");
        }
        if(this.getManager() != null){
            this.toNext(request);
        }
    }

    @Override
    public void next(Manager manager) {
        this.setManager(manager);
    }

    @Override
    public void toNext(Request request) {
        this.getManager().getResult(request);
    }

}
